<form [formGroup]="formModel" (submit)="onSubmit()">
  <div>
    <label>用户名：</label>
    <input [class.hasError]="formModel.get('username').invalid && formModel.get('username').touched" type="text" formControlName="username">
    <div [hidden]="formModel.get('username').valid || formModel.get('username').untouched">
      <div [hidden]="!formModel.hasError('required','username')">
        用户名是必填项
      </div>
      <div [hidden]="!formModel.hasError('minlength','username')">
        最小长度6
      </div>
    </div>
  </div>
  <div>
    <label>手机号：</label>
    <input type="number" formControlName="mobile">
    <div [hidden]="formModel.get('mobile').valid || formModel.get('mobile').pristine">
      <div [hidden]="!formModel.hasError('mobile','mobile')">
        请输入正确的手机号！
      </div>
    </div>
    <!--<div [hidden]="formModel.get('mobile').pending">-->
      <!--正在校验手机号合法性-->
    <!--</div>-->
  </div>
  <div formGroupName="passwordsGroup">
    <div>
      <label>密码：</label>
      <input type="password" formControlName="password">
    </div>
    <div [hidden]="!formModel.hasError('minlength',['passwordsGroup','password'])">
      密码最小长度为6位
    </div>
    <div>
      <label>确认密码：</label>
      <input type="password" formControlName="pconfig">
    </div>
    <div [hidden]="!formModel.hasError('equal','passwordsGroup')">
      {{formModel.getError('equal','passwordsGroup')?.desc}}
    </div>
  </div>
  <div>
    <button type="submit">注册</button>
  </div>
</form>
<!--<div>-->
  <!--{{formModel.status}}-->
<!--</div>-->
